#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
//	system("start https://www.lanqiao.cn/problems/597/learning/");

    vector<int> days = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

    int y, m, d, date;
    y = 2000;
    m = 1;
    d = 1;
    date = 6;

    int ans = 0;

    while(1) {
        if(date == 1 || d == 1)
            ans += 2;
        else
            ans += 1;

        if(y == 2020 && m == 10 && d == 1)	break;

        date = (date + 1) % 7;

        d++;
        if(d > days[m]) {
            d = 1;
            m++;
            if(m > 12) {
                m = 1;
                y++;
                if((y % 4 == 0 && y % 100) || (y % 400 == 0))
                    days[2] = 29;
                else
                    days[2] = 28;
            }
        }
    }

    cout << ans;

    return 0;
}

